library SetBossInvulnerability requires EventStruct

globals
	constant integer ADDITION = 0
	constant integer SUBTRACTION = 1
endglobals

struct EventSetBossInvulnerability extends Event
	Boss boss
	integer amount
	integer operation
	
    static method create takes integer whichBoss, integer operation, integer amount returns thistype
        local thistype this = thistype.allocate()
		set this.boss = bossTable[whichBoss]
		set this.operation = operation
		set this.amount = amount
        return this
    endmethod

	method do takes integer pid returns nothing
		if operation == ADDITION then
			set boss.isInvuln = boss.isInvuln + amount
		elseif operation == SUBTRACTION then
			set boss.isInvuln = boss.isInvuln - amount
		endif
		call doNext(pid)
	endmethod
endstruct

endlibrary